<template>
    <div>
        <el-dialog title="附件" :visible.sync="pictureBox" width="50%" :modal="false" :close-on-click-modal="false">
            <span>
                <el-image style="width: 200px; height: 200px;" :src="require('@/static/201543344_Zy3.png')"></el-image>
            </span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="pictureBox=false">取 消</el-button>
                <el-button type="primary" @click="pictureBox=false">确 定</el-button>
            </span>
        </el-dialog>
        <el-steps :active="0" simple>
            <el-step title="学生自评申请"></el-step>
            <el-step title="班级审核"></el-step>
            <el-step title="班内公示"></el-step>
            <el-step title="学院复审"></el-step>
            <el-step title="学校核定"></el-step>
        </el-steps>
        <div style="width: 60%;">
            <el-descriptions title="" :column=3 :colon=false style="margin-top:5%">
                <el-descriptions-item label="自评分数：">{{Self_Score}}</el-descriptions-item>
                <el-descriptions-item label="班委评分：">{{Class_com_score}}</el-descriptions-item>
                <el-descriptions-item label="综测班级排名：">{{zc_rank}}</el-descriptions-item>
                <el-descriptions-item label="学业绩点：">{{GPA}}</el-descriptions-item>
                <el-descriptions-item label="绩点排名：">{{GPA_rank}}</el-descriptions-item>
                <el-descriptions-item label="不及格科目数：">{{Failed_Num}}</el-descriptions-item>
                <el-descriptions-item label=''></el-descriptions-item>
            </el-descriptions>
          <div style="right: -300px;position: absolute;top: 5px">
            <el-button style="background-color:rgb(64,149,229);position: relative;color: aliceblue; font-size: 16px;"
            @click="goWord()">导出Word</el-button>
          </div>
            <div class="right">
                <el-button
                    style="background-color:rgb(64,149,229);position: relative;color: aliceblue; font-size: 16px;"
                    @click="submitData">提交</el-button>
            </div>
        </div>

        <!-- 各项分数表格 -->
        <div style="display: flex;flex-direction: column; height: 100%;">
            <!-- 智育分 -->
            <template class="form1" style="flex:1;">
                <!--新增/编辑界面-->
                <el-dialog :title="titleMap[dialogStatus]" :visible.sync="ZydialogVisiable" :show-close="false">
                    <el-form :model="form" label-width="80px" ref="form">

                        <div style="display:flex">
                            <el-form-item label="班委评分" width="80px">
                                <el-input class="dialog_input3" v-model="form.zyBwScore"
                                    onkeyup="value=value.replace(/[^\d]/g,'')"
                                    oninput="if(value>100)value=100;if(value<0)value=0"></el-input>
                            </el-form-item>
                        </div>
                        <el-form-item label="日期" width="80px">
                            <el-date-picker v-model="form.zyNewTime" type="date" placeholder="选择日期"
                                value-format="yyyy.MM.dd">
                            </el-date-picker>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">

                        <div slot="footer" class="dialog-footer">
                            <el-button v-if="editBtnshow" type="primary" @click.native="confirmEdit('form')">确定
                            </el-button>
                            <el-button @click.native="handleCancel('form')">取消</el-button>
                        </div>
                    </div>
                </el-dialog>
                <!-- <el-button type="primary" size="small" @click="removeZyData()">批量删除</el-button> -->
                <div style="margin-top:1px">
                    <h3 style="font-size: 15px;text-align: center;">“智育分”（60%）模块综合评定</h3>
                    <el-table
                        :data="ZyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                        border highlight-current-row v-loading="listLoading" @selection-change="selsChange"
                        style="width: 100%;" :stripe=true>
                        <el-table-column prop="index" label="序号" width="50" type="index">
                        </el-table-column>
                        <el-table-column prop="xxName" label="细项名称" width="120">
                        </el-table-column>
                        <el-table-column prop="contentSm" label="内容说明" width="280">
                        </el-table-column>
                        <el-table-column label="证明材料" width="180">
                            <el-button type="text" @click="pictureBox=true">查看附件</el-button>
                        </el-table-column>
                        <el-table-column prop="sugScore" label="建议评分" width="80">
                        </el-table-column>
                        <el-table-column prop="zySelfScore" label="自评分" width="80">
                        </el-table-column>
                        <el-table-column prop="zyBwScore" label="班委评分" width="80">
                        </el-table-column>
                        <el-table-column prop="zyNewTime" label="更新时间" width="100">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button type="text" size="small" @click="handleEdit(scope.$index, scope.row)">评分
                                </el-button>
                                <el-button size="small" type="text" @click="handleDelete(scope.$index, $event)"
                                    name="zy">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <div class="block">
                        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                            :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                            :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                            :total="ZyData.length">
                        </el-pagination>
                    </div>
                </div>

            </template>

            <!-- 德育分 -->
            <template class="form1" style="flex: 1;">
                <el-dialog style="width: 100%;height: 1000px;" title="增添细项" :visible.sync="DydialogVisiable"
                    :show-close="false">
                    <el-form :model="form">
                        <!-- <el-form-item label="细项名称" width="80px">
                            <el-input class="dialog_input" v-model="form.xxName"></el-input>
                        </el-form-item> -->
                        <el-form-item label="细项名称" width="80px">
                            <el-select class="dialog_input1" v-model="form.xxName" placeholder="请选择">
                                <el-option label="德育基础分" value="德育基础分"></el-option>
                                <el-option label="德育附加分" value="德育附加分"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="内容说明" width="80px">
                            <el-input class="dialog_input2" v-model="form.contentSm"></el-input>
                        </el-form-item>

                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" @click="Dysubmit">确 定</el-button>
                        <el-button @click="DydialogVisiable = false">取 消</el-button>
                    </div>
                </el-dialog>
                <h3 style="font-size: 15px;text-align: center;">“德育分”（20%）模块综合评定</h3>
                <el-table
                    :data="DyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                    border v-loading=false style="width:100%">
                    <el-table-column prop="index" label="序号" width="50" type="index">
                    </el-table-column>
                    <el-table-column prop="xxName" label="细项名称" width="120">
                    </el-table-column>
                    <el-table-column prop="contentSm" label="内容说明" width="280">
                    </el-table-column>
                    <el-table-column label="证明材料" width="180">
                        <el-button type="text" @click="pictureBox=true">查看附件</el-button>
                    </el-table-column>
                    <el-table-column prop="sugScore" label="建议评分" width="80">
                    </el-table-column>
                    <el-table-column prop="dySelfScore" label="自评分" width="80">
                    </el-table-column>
                    <el-table-column prop="dyBwScore" label="班委评分" width="80">
                    </el-table-column>
                    <el-table-column prop="dyNewTime" label="更新时间" width="100">
                    </el-table-column>
                    <el-table-column label="操作">
                        <template slot-scope="scope">
                            <el-button @click="DydialogVisiable = true" type="text" size="small">评分</el-button>
                            <el-button @click="handleDelete(scope.$index, $event)" type="text" size="small" name='dy'>删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="block">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                        :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                        :total="DyData.length">
                    </el-pagination>
                </div>
            </template>

            <!-- 体育分 -->
            <template class="form1" style="flex: 1;">
                <el-dialog style="width: 100%;height: 1000px;" title="增添细项" :visible.sync="TydialogVisiable"
                    :show-close="false">
                    <el-form :model="form">

                        <el-form-item label="细项名称" width="80px">
                            <el-select class="dialog_input1" v-model="form.xxName" placeholder="请选择">
                                <el-option label="体育基础分" value="体育基础分"></el-option>
                                <el-option label="体育附加分" value="体育附加分"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="内容说明" width="80px">
                            <el-input class="dialog_input2" v-model="form.contentSm"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
                                :before-remove="beforeRemove" multiple>
                                <el-button size="small" type="primary">上传证明材料</el-button>
                                <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
                            </el-upload>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" @click="Tysubmit">确 定</el-button>
                        <el-button @click="TydialogVisiable = false">取 消</el-button>
                    </div>
                </el-dialog>
                <h3 style="font-size: 15px;text-align: center;">“体育分”（10%）模块综合评定</h3>
                <el-table
                    :data="TyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                    border v-loading=false style="width:100%">
                    <el-table-column prop="index" label="序号" width="50" type="index">
                    </el-table-column>
                    <el-table-column prop="xxName" label="细项名称" width="120">
                    </el-table-column>
                    <el-table-column prop="contentSm" label="内容说明" width="280">
                    </el-table-column>
                    <el-table-column label="证明材料" width="180">
                        <el-button type="text" @click="pictureBox=true">查看附件</el-button>
                    </el-table-column>
                    <el-table-column prop="sugScore" label="建议评分" width="80">
                    </el-table-column>
                    <el-table-column prop="tySelfScore" label="自评分" width="80">
                    </el-table-column>
                    <el-table-column prop="tyBwScore" label="班委评分" width="80">
                    </el-table-column>
                    <el-table-column prop="tyNewTime" label="更新时间" width="100">
                    </el-table-column>
                    <el-table-column label="操作">
                        <template slot-scope="scope">
                            <el-button @click="handleClick(scope.row)" type="text" size="small">评分</el-button>
                            <el-button @click="handleDelete(scope.$index, $event)" type="text" size="small" name='ty'>删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="block">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                        :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                        :total="TyData.length">
                    </el-pagination>
                </div>
            </template>

            <!-- 劳育分 -->
            <template class="form1" style="flex: 1;">

                <el-dialog style="width: 100%;height: 1000px;" title="增添细项" :visible.sync="LydialogVisiable"
                    :show-close="false">
                    <el-form :model="form">
                        <!-- <el-form-item label="细项名称" width="80px">
                            <el-input class="dialog_input" v-model="form.xxName"></el-input>
                        </el-form-item> -->
                        <el-form-item label="细项名称" width="80px">
                            <el-select class="dialog_input1" v-model="form.xxName" placeholder="请选择">
                                <el-option label="劳育基础分" value="劳育基础分"></el-option>
                                <el-option label="劳育附加分" value="劳育附加分"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="内容说明" width="80px">
                            <el-input class="dialog_input2" v-model="form.contentSm"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
                                :before-remove="beforeRemove" multiple>
                                <el-button size="small" type="primary">上传证明材料</el-button>
                                <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
                            </el-upload>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" @click="Lysubmit">确 定</el-button>
                        <el-button @click="LydialogVisiable = false">取 消</el-button>
                    </div>
                </el-dialog>
                <h3 style="font-size: 15px;text-align: center;">“劳育分”（5%）模块综合评定</h3>
                <el-table
                    :data="LyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                    border v-loading=false style="width:100%">
                    <el-table-column prop="index" label="序号" width="50" type="index">
                    </el-table-column>
                    <el-table-column prop="xxName" label="细项名称" width="120">
                    </el-table-column>
                    <el-table-column prop="contentSm" label="内容说明" width="280">
                    </el-table-column>
                    <el-table-column label="证明材料" width="180">
                        <el-button type="text" @click="pictureBox=true">查看附件</el-button>
                    </el-table-column>
                    <el-table-column prop="sugScore" label="建议评分" width="80">
                    </el-table-column>
                    <el-table-column prop="lySelfScore" label="自评分" width="80">
                    </el-table-column>
                    <el-table-column prop="lyBwScore" label="班委评分" width="80">
                    </el-table-column>
                    <el-table-column prop="lyNewTime" label="更新时间" width="100">
                    </el-table-column>
                    <el-table-column label="操作">
                        <template slot-scope="scope">
                            <el-button @click="handleClick(scope.row)" type="text" size="small">评分</el-button>
                            <el-button @click="handleDelete(scope.$index, $event)" type="text" size="small" name='ly'>删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="block">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                        :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                        :total="LyData.length">
                    </el-pagination>
                </div>
            </template>

            <!-- 美育分 -->
            <template class="form1" style="flex: 1;">
                <el-dialog style="width: 100%;height: 1000px;" title="增添细项" :visible.sync="MydialogVisiable"
                    :show-close="false">
                    <el-form :model="form">
                        <el-form-item label="细项名称" width="80px">
                            <el-select class="dialog_input1" v-model="form.xxName" placeholder="请选择">
                                <el-option label="美育基础分" value="美育基础分"></el-option>
                                <el-option label="美育附加分" value="美育附加分"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="内容说明" width="80px">
                            <el-input class="dialog_input2" v-model="form.contentSm"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
                                :before-remove="beforeRemove" multiple>
                                <el-button size="small" type="primary">上传证明材料</el-button>
                                <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
                            </el-upload>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" @click="Mysubmit">确 定</el-button>
                        <el-button @click="MydialogVisiable = false">取 消</el-button>
                    </div>
                </el-dialog>
                <h3 style="font-size: 15px;text-align: center;">“美育分”（5%）模块综合评定</h3>
                <el-table
                    :data="MyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                    border v-loading=false style="width:100%">
                    <el-table-column prop="index" label="序号" width="50" type="index">
                    </el-table-column>
                    <el-table-column prop="xxName" label="细项名称" width="120">
                    </el-table-column>
                    <el-table-column prop="contentSm" label="内容说明" width="280">
                    </el-table-column>
                    <el-table-column label="证明材料" width="180">
                        <el-button type="text" @click="pictureBox=true">查看附件</el-button>
                    </el-table-column>
                    <el-table-column prop="sugScore" label="建议评分" width="80">
                    </el-table-column>
                    <el-table-column prop="mySelfScore" label="自评分" width="80">
                    </el-table-column>
                    <el-table-column prop="myBwScore" label="班委评分" width="80">
                    </el-table-column>
                    <el-table-column prop="myNewTime" label="更新时间" width="100">
                    </el-table-column>
                    <el-table-column label="操作">
                        <template slot-scope="scope">
                            <el-button @click="handleClick(scope.row)" type="text" size="small">评分</el-button>
                            <el-button @click="handleDelete(scope.$index, $event)" type="text" size="small" name='my'>删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="block">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                        :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                        :total="MyData.length">
                    </el-pagination>
                </div>
            </template>
        </div>
    </div>

</template>

<script>
var _index
export default {
  name: 'Self_of_s',
  data () {
    return {
      pictureBox: false,
      dialogVisible: false,
      usernum: this.$store.state.com_data.usernum,
      Self_Score: 100,
      Class_com_score: '',
      zc_rank: 3,
      GPA: 3.5,
      GPA_rank: 3,
      Failed_Num: 0,
      stripe: true,
      dialogVisiable: false,
      loading: true,
      FormVisible: false,
      currentRow: [],
      ids: [],
      listLoading: '',
      addBtnshow: false,
      editBtnshow: false,
      editLoading: '',
      dialogStatus: '',
      selected: [],
      editid: '',
      searchForm: [],
      pickerOptions: {
        disabledDate (time) {
          return time.getTime() > Date.now();
        }
      },
      form: {
        xxName: '',
        contentSm: 0,
        zySelfScore: '',
        zyBwScore: '',
        zyNewTime: '',
      },
      ZyData: [{
        stuNum:this.$store.state.com_data.userNum,
        classNum: this.$store.state.com_data.classNum,
        xxName: '智育基本分',
        contentSm: '学习成绩',
        eviMat: '查看附件',
        sugScore: 1,
        zySelfScore: 90,
        zyBwScore: 100,
        zyNewTime: '2021.10.10'
      }
      ],
      DyData: [{
        stuNum:this.$store.state.com_data.userNum,
        classNum: this.$store.state.com_data.classNum,
        xxName: '德育基本分',
        contentSm: '学习成绩',
        eviMat: '查看附件',
        sugScore: -4,
        dySelfScore: 100,
        dyBwScore: 100,
        dyNewTime: '2021.10.10'
      }
      ],
      TyData: [{
        stuNum:this.$store.state.com_data.userNum,
        classNum: this.$store.state.com_data.classNum,
        xxName: '体育基本分',
        contentSm: '学习成绩',
        eviMat: '查看附件',
        sugScore: 4,
        tySelfScore: 100,
        tyBwScore: 100,
        tyNewTime: '2021.10.10'
      }
      ],
      MyData: [{
        stuNum:this.$store.state.com_data.userNum,
        classNum: this.$store.state.com_data.classNum,
        xxName: '美育基本分',
        contentSm: '学习成绩',
        eviMat: '查看附件',
        sugScore: 4,
        mySelfScore: 100,
        myBwScore: 100,
        myNewTime: '2021.10.10'
      }
      ],
      LyData: [{
        stuNum:this.$store.state.com_data.userNum,
        classNum: this.$store.state.com_data.classNum,
        xxName: '劳育基本分',
        contentSm: '学习成绩',
        eviMat: '查看附件',
        sugScore: 4,
        lySelfScore: 100,
        lyBwScore: 100,
        lyNewTime: '2021.10.10'
      }
      ],
      titleMap: {
        addEquipment: '新增细项',
        editEquipment: '编辑细项'
      },
      ZydialogVisiable: false,
      DydialogVisiable: false,
      TydialogVisiable: false,
      LydialogVisiable: false,
      MydialogVisiable: false,
      paginations: {
        // 默认显示第几页
        currentPage: 1,
        // 个数选择器（可修改）
        pageSizes: [1, 2, 3, 4],
        // 默认每页显示的条数（可修改）
        PageSize: 4,
      },
    }
  },
  methods: {

    goWord(){
      this.$axios.post('http://localhost/login/l',{ZyData: this.ZyData, DyData: this.DyData}).then(res => {
        if(res.status===200)
          alert("导出成功")
      })
    },

    handleClick (row) {
      console.log(row)
    },
    handleDelete (indexx, e) {
      switch (e.currentTarget.getAttributeNode('name').value) {
        case 'zy':
          this.ZyData.splice(indexx, 1)
          break
        case 'dy':
          this.DyData.splice(indexx, 1)
          break
        case 'ty':
          this.TyData.splice(indexx, 1)
          break
        case 'ly':
          this.LyData.splice(indexx, 1)
          break
        case 'my':
          this.MyData.splice(indexx, 1)
          break
      }
    },

    // 每页显示多少条
    handleSizeChange (val) {
      // 改变每页显示的条数
      this.paginations.PageSize = val
      // 注意：在改变每页显示的条数时，要将页码显示到第一页
      this.paginations.currentPage = 1
      console.log(`每页 ${val} 条`);
    },
    // 现在显示当前页的第几页
    handleCurrentChange (val) {
      // 改变默认的页数
      this.paginations.currentPage = val
      console.log(`当前页: ${val}`);
    },

    // 智育新增数据
    ZyaddData () {
      this.form = {
        xxName: '',
        contentSm: '',
        eviMat: '查看附件',
        sugScore: 4,
        zySelfScore: 100,
        zyBwScore: 100,
        zyNewTime: '2021.10.10'
      }
      this.ZydialogVisiable = true
      this.addBtnshow = true
    },
    Zysubmit () {
      // this.form.date = reformat(this.form.date); //日期类型转换
      this.ZyData.push(this.form) //向ZyData中添加数据
      this.ZydialogVisiable = false   //自定义对话框隐藏
      this.addBtnshow = false
    },

    // 德育新增数据
    DyaddData () {
      this.form = {
        xxName: '',
        contentSm: '',
        eviMat: '查看附件',
        sugScore: 4,
        dySelfScore: 100,
        dyBwScore: 100,
        dyNewTime: '2021.10.10'
      }
      this.DydialogVisiable = true
    },
    Dysubmit () {
      // this.form.date = reformat(this.form.date); //日期类型转换
      this.DyData.push(this.form) //向DyData中添加数据
      this.DydialogVisiable = false   //自定义对话框隐藏
    },

    //      劳育新增数据
    LyaddData () {
      this.form = {
        xxName: '',
        contentSm: '',
        eviMat: '查看附件',
        sugScore: 4,
        lySelfScore: 100,
        lyBwScore: 100,
        lyNewTime: '2021.10.10'
      }
      this.LydialogVisiable = true
    },
    Lysubmit () {
      // this.form.date = reformat(this.form.date); //日期类型转换
      this.LyData.push(this.form) //向LyData中添加数据
      this.LydialogVisiable = false   //自定义对话框隐藏
    },

    // 美育新增数据
    MyaddData () {
      this.form = {
        xxName: '',
        contentSm: '',
        eviMat: '查看附件',
        sugScore: 4,
        mySelfScore: 100,
        myBwScore: 100,
        myNewTime: '2021.10.10'
      }
      this.MydialogVisiable = true
    },
    Mysubmit () {
      this.MyData.push(this.form) //向MyData中添加数据
      this.MydialogVisiable = false   //自定义对话框隐藏
    },

    TyaddData () {
      this.form = {
        xxName: '',
        contentSm: '',
        eviMat: '查看附件',
        sugScore: 4,
        tySelfScore: 100,
        tyBwScore: 100,
        tyNewTime: '2021.10.10'
      }
      this.TydialogVisiable = true
    },
    Tysubmit () {
      // this.form.date = reformat(this.form.date); //日期类型转换
      this.TyData.push(this.form) //向TyData中添加数据
      this.TydialogVisiable = false   //自定义对话框隐藏
    },

    beforeRemove (file, fileList) {
      return this.$confirm(`确定移除 ${file.name}?`);
    },
    submitData () {
      this.$axios.post(`http://localhost:/classDis/add/${window.sessionStorage.getItem("name")}`, {
        ZyData: this.ZyData,
        DyData: this.DyData,
        TyData: this.TyData,
        LyData: this.LyData,
        MyData: this.MyData
      }, {}).then(res => {
        // console.log(res);

      })
    },
    selsChange: function (val) {  //点击选中
      console.log(val);
      this.selected = val;
    },
    // 点击新增
    addRow (ZyData, event) {
      this.FormVisible = false;
      this.form = {
        index: 0,
        xxName: '',
        contentSm: '',
        zySelfScore: '',
        zyBwScore: '',
        zyNewTime: '',
      };
      this.dialogStatus = "addEquipment"
      this.addBtnshow = true
      this.editBtnshow = false
    },
    // 点击确定（新增）
    confirmAdd () {
      this.ZyData.push({
        xxName: this.form.xxName,
        contentSm: this.form.contentSm,
        zySelfScore: this.form.zySelfScore,
        zyBwScore: this.form.zyBwScore,
        zyNewTime: this.form.zyNewTime
      })
      this.ZydialogVisiable = false;
    },
    //点击编辑
    handleEdit: function (index, row) {
      this.ZydialogVisiable = true;
      this.form = Object.assign({}, row); //这句是关键！！！
      _index = index;
      console.log(index);
      console.log(_index);
      this.dialogStatus = "editEquipment"
      this.addBtnshow = false
      this.editBtnshow = true
    },
    // 点击确定（编辑）
    confirmEdit () {
      var editdata = _index;
      console.log(editdata);
      this.ZyData[editdata].xxName = this.form.xxName;
      this.ZyData[editdata].contentSm = this.form.contentSm;
      this.ZyData[editdata].zySelfScore = this.form.zySelfScore;
      this.ZyData[editdata].zyBwScore = this.form.zyBwScore;
      this.ZyData[editdata].zyNewTime = this.form.zyNewTime;
      this.ZydialogVisiable = false;
      // 我的 更新的时候就把弹出来的表单中的数据写到要修改的表格中
      // var postdata = {
      //   name: this.Form.name,
      //    contentSm: this.Form.contentSm,
      //    zySelfScore: this.Form.zySelfScore,
      //    zyBwScore: this.Form.zyBwScore,
      //    zyNewTime: this.Form.zyNewTime,
      // }
      //这里再向后台发个post请求重新渲染表格数据
      // this.$set(this.ZyData,'name')
      // let studenteList=this.Form;
      // console.log(studenteList);
      // let {name,contentSm,zySelfScore,zyBwScore,zyNewTime} = studenteList;

    },
    //点击关闭dialog
    handleClose (done) {
      this.FormVisible = false;
    },
    //点击取消
    handleCancel (formName) {
      this.ZydialogVisiable = false;
    }
  },

  mounted () {

    let length1 = 0
    let Sum = 0
    this.$axios.get(`http://localhost:/self/selectZyData/${window.sessionStorage.getItem("shStuNum")}`, { usernum: this.usernum }).then(res => {
      if (res.status === 200) {
        this.ZyData = res.data
        // console.log(res.data)
        for (let item = 0; item < res.data.length; item++) {
          Sum = Sum + res.data[item].zyBwScore
        }
        length1 += res.data.length

      } else {
        return '请求失败'
      }
    })
    this.$axios.get(`http://localhost:/self/selectDyData/${window.sessionStorage.getItem("shStuNum")}`, { usernum: this.usernum }).then(res => {
      if (res.status === 200) {
        this.DyData = res.data
        length1 += res.data.length
        for (let item = 0; item < res.data.length; item++) {
          Sum = Sum + res.data[item].dyBwScore
        }
      } else {
        return '请求失败'
      }
    })
    this.$axios.get(`http://localhost:/self/selectMyData/${window.sessionStorage.getItem("shStuNum")}`, { usernum: this.usernum }).then(res => {
      if (res.status === 200) {
        this.MyData = res.data
        length1 += res.data.length
        for (let item = 0; item < res.data.length; item++) {
          Sum = Sum + res.data[item].myBwScore
        }
      } else {
        return '请求失败'
      }
    })
    this.$axios.get(`http://localhost:/self/selectLyData/${window.sessionStorage.getItem("shStuNum")}`, { usernum: this.usernum }).then(res => {
      if (res.status === 200) {
        this.LyData = res.data
        length1 += res.data.length
        for (let item = 0; item < res.data.length; item++) {
          Sum = Sum + res.data[item].lyBwScore
        }
      } else {
        return '请求失败'
      }
    })
    this.$axios.get(`http://localhost:/self/selectTyData/${window.sessionStorage.getItem("shStuNum")}`, { usernum: this.usernum }).then(res => {
      if (res.status === 200) {
        this.TyData = res.data
        length1 += res.data.length
        for (let item = 0; item < res.data.length; item++) {
          Sum = Sum + res.data[item].tyBwScore
        }
      } else {
        return '请求失败'
      }
      // console.log(Sum, length1)
      this.Class_com_score = Sum / length1
    })

  }
}

</script>
<style lang="less" scoped>
.left {
    float: left;
    /* margin-top: 40px; */
}

.right {
    position: absolute;
    top: 6.5%;
    right: -66%;
    font-family: “Microsoft YaHei”;
}

.shenhe {
    width: 180px;
    height: 50px;
    font-size: 14px;
    text-align: center;
    line-height: 50px;
    margin-bottom: 4px;
    border: 2px solid #ccc;
}

.form1 {
    width: 100%;

}

.dialog_input2 {
    width: 31%;
}

.select_first {
    width: 150px;
    height: 30px;
    border: 1px solid #ccc;
    outline: medium
}

.rank {
    display: inline-block;
    padding: 4px;
    font-size: 14px;
    background-color: skyblue;
}

.add {
    height: 3.5%;
    margin-bottom: -45px;
    // top: 12px
}
</style>


